CODEGEN_DIR = ../../../codegen
CODEGEN = $(CODEGEN_DIR)/codegen.pl -I$(CODEGEN_DIR) -w75
CLASSES= \
	message host module \
	data_reader data_writer data_input data_output \
	sound_reader sound_writer sound_input sound_output \
	decoder dsp encoder playlist filesystem database
HEADERS = rc.h \
	$(foreach CLASS, $(CLASSES), \
		$(CLASS)_ptr.hpp \
		$(CLASS)_api.hpp \
		$(CLASS)_api.h)

.PHONY: all install clean

all: $(HEADERS)

install:

%_ptr.hpp: wrap.tmpl.hpp bamp.api
	$(CODEGEN) -D "CLASSNAME=bamp::$*" -i wrap.tmpl.hpp -o $@
%_api.hpp: api.tmpl.hpp bamp.api
	$(CODEGEN) -D "CLASSNAME=bamp::$*" -i api.tmpl.hpp -o $@
%_api.h: api.tmpl.h bamp.api
	$(CODEGEN) -D "CLASSNAME=bamp::$*" -i api.tmpl.h -o $@

rc.h: rc.h.tmpl
	$(CODEGEN) -i $^ -o $@

clean:
	rm -f $(HEADERS)
